/**
 * sr-sdk-wxapp v1.7.3
 * (c) 2021 tabpan,glennzou,edenxing
 * @license ISC
 */
import track from '../track/complex/extend-PV'
! function (t, e) {
  "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = t || self).SRT = e()
}(this, (function () {
  "use strict";
  /*! *****************************************************************************
      Copyright (c) Microsoft Corporation. All rights reserved.
      Licensed under the Apache License, Version 2.0 (the "License"); you may not use
      this file except in compliance with the License. You may obtain a copy of the
      License at http://www.apache.org/licenses/LICENSE-2.0

      THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
      KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
      WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
      MERCHANTABLITY OR NON-INFRINGEMENT.

      See the Apache Version 2.0 License for specific language governing permissions
      and limitations under the License.
      ***************************************************************************** */
  var t = function (e, r) {
    return (t = Object.setPrototypeOf || {
      __proto__: []
    }
      instanceof Array && function (t, e) {
        t.__proto__ = e
      } || function (t, e) {
        for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r])
      })(e, r)
  };

  function e(e, r) {
    function i() {
      this.constructor = e
    }
    t(e, r), e.prototype = null === r ? Object.create(r) : (i.prototype = r.prototype, new i)
  }
  var r = function () {
    return (r = Object.assign || function (t) {
      for (var e, r = 1, i = arguments.length; r < i; r++)
        for (var o in e = arguments[r]) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
      return t
    }).apply(this, arguments)
  };

  function i(t, e, r, i) {
    var o, s = arguments.length,
      n = s < 3 ? e : null === i ? i = Object.getOwnPropertyDescriptor(e, r) : i;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) n = Reflect.decorate(t, e, r, i);
    else
      for (var a = t.length - 1; a >= 0; a--)(o = t[a]) && (n = (s < 3 ? o(n) : s > 3 ? o(e, r, n) : o(e, r)) || n);
    return s > 3 && n && Object.defineProperty(e, r, n), n
  }

  function o() {
    for (var t = 0, e = 0, r = arguments.length; e < r; e++) t += arguments[e].length;
    var i = Array(t),
      o = 0;
    for (e = 0; e < r; e++)
      for (var s = arguments[e], n = 0, a = s.length; n < a; n++, o++) i[o] = s[n];
    return i
  }
  try {
    Object.entries || (Object.entries = function (t) {
      for (var e = Object.keys(t), r = e.length, i = new Array(r); r--;) i[r] = [e[r], t[e[r]]];
      return i
    }), Array.prototype.includes || (Array.prototype.includes = function (t) {
      return !!~this.indexOf(t)
    })
  } catch (t) {
    console.error("polyfill exec failed", t)
  }
  var s, n, a = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    h = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,
    c = function (t) {
      return function (t) {
        for (var e, r, i, o, s = "", n = 0, h = (t = String(t)).length % 3; n < t.length;) {
          if ((r = t.charCodeAt(n++)) > 255 || (i = t.charCodeAt(n++)) > 255 || (o = t.charCodeAt(n++)) > 255) throw new TypeError("Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.");
          s += a.charAt((e = r << 16 | i << 8 | o) >> 18 & 63) + a.charAt(e >> 12 & 63) + a.charAt(e >> 6 & 63) + a.charAt(63 & e)
        }
        return h ? s.slice(0, h - 3) + "===".substring(h) : s
      }(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g, (function (t, e) {
        var r;
        return r = "0x" + e, String.fromCharCode(r)
      })))
    },
    u = function (t) {
      return decodeURIComponent(function (t) {
        if (t = String(t).replace(/[\t\n\f\r ]+/g, ""), !h.test(t)) throw new TypeError("Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.");
        t += "==".slice(2 - (3 & t.length));
        for (var e, r, i, o = "", s = 0; s < t.length;) e = a.indexOf(t.charAt(s++)) << 18 | a.indexOf(t.charAt(s++)) << 12 | (r = a.indexOf(t.charAt(s++))) << 6 | (i = a.indexOf(t.charAt(s++))), o += 64 === r ? String.fromCharCode(e >> 16 & 255) : 64 === i ? String.fromCharCode(e >> 16 & 255, e >> 8 & 255) : String.fromCharCode(e >> 16 & 255, e >> 8 & 255, 255 & e);
        return o
      }(t).split("").map((function (t) {
        return "%" + ("00" + t.charCodeAt(0).toString(16)).slice(-2)
      })).join(""))
    },
    d = {
      encode: function (t) {
        return c(t).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_")
      },
      decode: function (t) {
        var e = (t = t.replace(/\-/g, "+").replace(/_/g, "/")).length % 4;
        return e > 0 && (t += "====".substring(e)), u(t)
      }
    },
    p = Object.prototype.toString,
    f = d,
    l = function (t) {
      return "[object Object]" === p.call(t)
    },
    _ = function (t) {
      return "[object Array]" === p.call(t)
    },
    g = function (t, e) {
      var r;
      void 0 === e && (e = 0);
      var i = [];
      return function () {
        for (var o = arguments, s = [], n = 0; n < arguments.length; n++) s[n] = o[n];
        return clearTimeout(r), r = setTimeout((function () {
          var e = t.apply(void 0, s);
          i.forEach((function (t) {
            return t(e)
          })), i = []
        }), e), new Promise((function (t) {
          return i.push(t)
        }))
      }
    },
    v = function () {
      return Date.now() + "-" + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (function (t) {
        var e = 16 * Math.random() | 0;
        return ("x" == t ? e : 3 & e | 8).toString(16)
      }))
    },
    y = function () {
      for (var t = arguments, e = [], r = 0; r < arguments.length; r++) e[r] = t[r];
      return 0 === e.length ? {} : e.length < 2 ? e[0] : e.reduce((function (t, e) {
        if (!l(t) || !l(e)) return console.error("deepMerge arguments only access object"), t;
        var r = t || {};
        return Object.entries(e).forEach((function (e) {
          var i = e[0],
            s = e[1];
          if (void 0 !== s)
            if (t[i])
              if (_(t[i])) {
                if (!_(s)) return void (r[i] = s);
                var n = _(s) ? s : [s];
                r[i] = o(t[i], n)
              } else l(t[i]) ? r[i] = y(t[i], s) : r[i] = s;
            else r[i] = s
        })), r
      }))
    },
    m = function (t) {
      return !!/^[a-zA-Z\$_][a-zA-Z\d_]*$/.test(t)
    },
    k = /^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,
    x = function (t) {
      if ("string" != typeof t) throw new TypeError("Invalid argument expected string");
      if (!k.test(t)) throw new Error("Invalid argument not valid semver ('" + t + "' received)")
    },
    S = function (t) {
      return isNaN(Number(t)) ? t : Number(t)
    },
    b = function (t) {
      var e, r, i = t.replace(/^v/, "").replace(/\+.*$/, ""),
        o = (r = "-", -1 === (e = i).indexOf(r) ? e.length : e.indexOf(r)),
        s = i.substring(0, o).split(".");
      return s.push(i.substring(o + 1)), s
    },
    I = function (t, e) {
      [t, e].forEach(x);
      for (var r = b(t), i = b(e), o = 0; o < Math.max(r.length - 1, i.length - 1); o++) {
        var s = parseInt(r[o] || 0, 10),
          n = parseInt(i[o] || 0, 10);
        if (s > n) return 1;
        if (n > s) return -1
      }
      var a = r[r.length - 1],
        h = i[i.length - 1];
      if (a && h) {
        var c = a.split(".").map(S),
          u = h.split(".").map(S);
        for (o = 0; o < Math.max(c.length, u.length); o++) {
          if (void 0 === c[o] || "string" == typeof u[o] && "number" == typeof c[o]) return -1;
          if (void 0 === u[o] || "string" == typeof c[o] && "number" == typeof u[o]) return 1;
          if (c[o] > u[o]) return 1;
          if (u[o] > c[o]) return -1
        }
      } else if (a || h) return a ? -1 : 1;
      return 0
    },
    w = function (t) {
      if ("string" == typeof t) return t;
      try {
        return (JSON.stringify(t, (e = [], r = [], function (t, i) {
          if (i instanceof Error) return "Error.message: " + i.message + " \n  Error.stack: " + i.stack;
          if ("object" == typeof i && null !== i) {
            var o = e.indexOf(i);
            if (-1 !== o) return "[Circular " + r[o] + "]";
            e.push(i), r.push(t || "root")
          }
          return i
        }), 4) || "undefined").replace(/"/gim, "")
      } catch (t) {
        return "error happen when sdk stringify: \n " + t.message + " \n " + t.stack
      }
      var e, r
    },
    A = function () {
      return "undefined" != typeof wx ? wx : "undefined" != typeof qq ? qq : "undefined" != typeof swan ? swan : "undefined" != typeof my ? my : wx
    },
    C = function (t) {
      function i(e) {
        var r = t.call(this, e.request) || this;
        return r.stack = [], r.initialize = function () {
          return Promise.resolve(!0)
        }, r.add = function (t) {
          r.stack.push(t)
        }, r.getItems = function () {
          return r.stack
        }, r.unshift = function (t) {
          var e;
          return (e = r.stack).unshift.apply(e, t)
        }, r.clean = function () {
          var t = r.stack;
          return r.stack = [], t
        }, r.checkQueue = function () {
          r.stack.length > 100 && (r.stack = r.stack.slice(-100))
        }, r.option = e, r.initialize(), r
      }
      return e(i, t), i.prototype.flush = function (t, e) {
        var i = this;
        if (void 0 === t && (t = {}), this.stack.length) {
          var s = JSON.parse(JSON.stringify(t));
          s.idenTifier = s.idenTifier + e;
          var n = this.stack.map((function (t) {
            return t.props = r(r({}, t.props), s), t
          }));
          this.stack = [], this.request({
            events: n
          }).then((function (t) {
            t.success || (i.stack = o(i.stack, n))
          })).catch((function () {
            i.stack = o(i.stack, n)
          }))
        }
      }, i
    }((function (t) {
      this.delay = 100, this.upload = g(t, this.delay), this.request = t
    })),
    O = "__SR_SDK_TRACKER__",
    T = "TRACKS",
    R = "USER_INFO",
    P = "LOGID_EVENTS",
    U = "IDENTIFIERUSER",
    q = "WAITING",
    F = "REPORTING",
    D = "PAUSED",
    E = {
      MISS: "should exec cacheManagerInitialize first"
    },
    N = "SDK_INTERNAL_ERROR",
    j = "JS_RUN_ERROR",
    H = "AJAX_ERROR",
    G = "ORDER_MISSING_ERROR",
    M = ["page", "page_title", "time", "chan_wxapp_scene", "chan_id", "chan_refer_app_id", "room_id"],
    z = ["app_id", "open_id", "user_id", "union_id", "local_id"],
    W = wx,
    L = [],
    J = W.request,
    K = function (t) {
      return L.forEach((function (e) {
        var r;
        try {
          null === (r = e.onStart) || void 0 === r || r.call(e, t)
        } catch (t) { }
      })), J(r(r({}, t), {
        success: function (e) {
          var r;
          L.forEach((function (r) {
            var i;
            try {
              null === (i = r.success) || void 0 === i || i.call(r, e, t)
            } catch (t) {
              try {
                s("sdk_error_log", {
                  _sdk_error_log: {
                    message: "request success error",
                    type: N,
                    error: t.message
                  }
                })
              } catch (t) { }
            }
          })), null === (r = t.success) || void 0 === r || r.call(t, e)
        },
        fail: function (e) {
          var r;
          L.forEach((function (r) {
            var i;
            try {
              null === (i = r.fail) || void 0 === i || i.call(r, e, t)
            } catch (t) {
              try {
                s("sdk_error_log", {
                  _sdk_error_log: {
                    message: "request fail error",
                    type: N,
                    error: t.message
                  }
                })
              } catch (t) { }
            }
          })), null === (r = t.fail) || void 0 === r || r.call(t, e)
        },
        complete: function (e) {
          var r;
          L.forEach((function (r) {
            var i;
            try {
              null === (i = r.complete) || void 0 === i || i.call(r, e, t)
            } catch (t) {
              try {
                s("sdk_error_log", {
                  _sdk_error_log: {
                    message: "request complete error",
                    type: N,
                    error: t.message
                  }
                })
              } catch (t) { }
            }
          })), null === (r = t.complete) || void 0 === r || r.call(t, e)
        }
      }))
    },
    B = !1,
    V = function (t, e) {
      s || (s = e), !B && function () {
        try {
          Object.defineProperty(W, "request", {
            get: function () {
              return K
            }
          })
        } catch (t) {
          console.warn("cannot override `request`, error is: ", t)
        } finally {
          B = !0
        }
      }(), L.push(t)
    },
    Q = wx,
    Z = wx,
    $ = [],
    X = Z.requestPayment,
    Y = Z.requestOrderPayment,
    tt = function (t, e) {
      var i = X;
      return "requestOrderPayment" == e && (i = Y), $.forEach((function (e) {
        var r;
        try {
          null === (r = e.onStart) || void 0 === r || r.call(e, t)
        } catch (t) {
          try {
            n("sdk_error_log", {
              _sdk_error_log: {
                message: "requestPayment onStart error",
                type: N,
                error: t.message
              }
            })
          } catch (t) { }
        }
      })), i(r(r({}, t), {
        success: function (e) {
          var r;
          $.forEach((function (r) {
            var i;
            try {
              null === (i = r.success) || void 0 === i || i.call(r, e, t)
            } catch (t) {
              try {
                n("sdk_error_log", {
                  _sdk_error_log: {
                    message: "requestPayment success error",
                    type: N,
                    error: t.message
                  }
                })
              } catch (t) { }
            }
          })), null === (r = t.success) || void 0 === r || r.call(t, e)
        },
        fail: function (e) {
          var r;
          $.forEach((function (r) {
            var i;
            try {
              null === (i = r.fail) || void 0 === i || i.call(r, e, t)
            } catch (t) {
              try {
                n("sdk_error_log", {
                  _sdk_error_log: {
                    message: "requestPayment fail error",
                    type: N,
                    error: t.message
                  }
                })
              } catch (t) { }
            }
          })), null === (r = t.fail) || void 0 === r || r.call(t, e)
        }
      }))
    },
    et = !1,
    rt = function (t, e) {
      n || (n = e), !et && function () {
        try {
          Object.defineProperty(Z, "requestPayment", {
            get: function () {
              return function (t) {
                return tt(t, "requestPayment")
              }
            }
          }), Object.defineProperty(Z, "requestOrderPayment", {
            get: function () {
              return function (t) {
                return tt(t, "requestOrderPayment")
              }
            }
          })
        } catch (t) {
          console.warn("cannot override `requestPayment`, error is: ", t)
        } finally {
          et = !0
        }
      }(), $.push(t)
    },
    it = function (t, e, r) {
      var i = r.value;
      return r.value = function () {
        var t;
        try {
          t = i.apply(this, arguments)
        } catch (t) {
          try {
            console.error("Calling " + e + " error with", arguments), console.error(t);
            var r = this.getServerUrl();
            this.request({
              type: "sdk api exec error",
              props: {
                sr_sdk_version: this.version,
                system_info: this.getSystemInfo(),
                framework_info: this.getFrameworkInfo(),
                message: (t || {}).message || t,
                stack: (t || {}).stack
              }
            }, {
              url: r,
              method: "POST"
            })
          } catch (t) { }
        }
        return t
      }, r
    },
    ot = function (t, e, r) {
      var i = r.value;
      return r.value = function () {
        if (this.inited) return i.apply(this, arguments);
        console.error("\u8bf7\u5148\u5b8c\u6210\u521d\u59cb\u5316")
      }, r
    },
    st = function () {
      function t() { }
      return t.AddUnsigned = function (t, e) {
        var r, i, o, s, n;
        return o = 2147483648 & t, s = 2147483648 & e, n = (1073741823 & t) + (1073741823 & e), (r = 1073741824 & t) & (i = 1073741824 & e) ? 2147483648 ^ n ^ o ^ s : r | i ? 1073741824 & n ? 3221225472 ^ n ^ o ^ s : 1073741824 ^ n ^ o ^ s : n ^ o ^ s
      }, t.FF = function (t, e, r, i, o, s, n) {
        return t = this.AddUnsigned(t, this.AddUnsigned(this.AddUnsigned(this.F(e, r, i), o), n)), this.AddUnsigned(this.RotateLeft(t, s), e)
      }, t.GG = function (t, e, r, i, o, s, n) {
        return t = this.AddUnsigned(t, this.AddUnsigned(this.AddUnsigned(this.G(e, r, i), o), n)), this.AddUnsigned(this.RotateLeft(t, s), e)
      }, t.HH = function (t, e, r, i, o, s, n) {
        return t = this.AddUnsigned(t, this.AddUnsigned(this.AddUnsigned(this.H(e, r, i), o), n)), this.AddUnsigned(this.RotateLeft(t, s), e)
      }, t.II = function (t, e, r, i, o, s, n) {
        return t = this.AddUnsigned(t, this.AddUnsigned(this.AddUnsigned(this.I(e, r, i), o), n)), this.AddUnsigned(this.RotateLeft(t, s), e)
      }, t.ConvertToWordArray = function (t) {
        for (var e, r = t.length, i = r + 8, o = 16 * ((i - i % 64) / 64 + 1), s = Array(o - 1), n = 0, a = 0; a < r;) n = a % 4 * 8, s[e = (a - a % 4) / 4] = s[e] | t.charCodeAt(a) << n, a++;
        return n = a % 4 * 8, s[e = (a - a % 4) / 4] = s[e] | 128 << n, s[o - 2] = r << 3, s[o - 1] = r >>> 29, s
      }, t.WordToHex = function (t) {
        var e, r = "",
          i = "";
        for (e = 0; e <= 3; e++) r += (i = "0" + (t >>> 8 * e & 255).toString(16)).substr(i.length - 2, 2);
        return r
      }, t.Utf8Encode = function (t) {
        var e, r = "";
        t = t.replace(/\r\n/g, "\n");
        for (var i = 0; i < t.length; i++)(e = t.charCodeAt(i)) < 128 ? r += String.fromCharCode(e) : e > 127 && e < 2048 ? (r += String.fromCharCode(e >> 6 | 192), r += String.fromCharCode(63 & e | 128)) : (r += String.fromCharCode(e >> 12 | 224), r += String.fromCharCode(e >> 6 & 63 | 128), r += String.fromCharCode(63 & e | 128));
        return r
      }, t.init = function (t) {
        for ("string" != typeof t && (t = JSON.stringify(t)), this._string = this.Utf8Encode(t), this.x = this.ConvertToWordArray(this._string), this.a = 1732584193, this.b = 4023233417, this.c = 2562383102, this.d = 271733878, this.k = 0; this.k < this.x.length; this.k += 16) this.AA = this.a, this.BB = this.b, this.CC = this.c, this.DD = this.d, this.a = this.FF(this.a, this.b, this.c, this.d, this.x[this.k], this.S11, 3614090360), this.d = this.FF(this.d, this.a, this.b, this.c, this.x[this.k + 1], this.S12, 3905402710), this.c = this.FF(this.c, this.d, this.a, this.b, this.x[this.k + 2], this.S13, 606105819), this.b = this.FF(this.b, this.c, this.d, this.a, this.x[this.k + 3], this.S14, 3250441966), this.a = this.FF(this.a, this.b, this.c, this.d, this.x[this.k + 4], this.S11, 4118548399), this.d = this.FF(this.d, this.a, this.b, this.c, this.x[this.k + 5], this.S12, 1200080426), this.c = this.FF(this.c, this.d, this.a, this.b, this.x[this.k + 6], this.S13, 2821735955), this.b = this.FF(this.b, this.c, this.d, this.a, this.x[this.k + 7], this.S14, 4249261313), this.a = this.FF(this.a, this.b, this.c, this.d, this.x[this.k + 8], this.S11, 1770035416), this.d = this.FF(this.d, this.a, this.b, this.c, this.x[this.k + 9], this.S12, 2336552879), this.c = this.FF(this.c, this.d, this.a, this.b, this.x[this.k + 10], this.S13, 4294925233), this.b = this.FF(this.b, this.c, this.d, this.a, this.x[this.k + 11], this.S14, 2304563134), this.a = this.FF(this.a, this.b, this.c, this.d, this.x[this.k + 12], this.S11, 1804603682), this.d = this.FF(this.d, this.a, this.b, this.c, this.x[this.k + 13], this.S12, 4254626195), this.c = this.FF(this.c, this.d, this.a, this.b, this.x[this.k + 14], this.S13, 2792965006), this.b = this.FF(this.b, this.c, this.d, this.a, this.x[this.k + 15], this.S14, 1236535329), this.a = this.GG(this.a, this.b, this.c, this.d, this.x[this.k + 1], this.S21, 4129170786), this.d = this.GG(this.d, this.a, this.b, this.c, this.x[this.k + 6], this.S22, 3225465664), this.c = this.GG(this.c, this.d, this.a, this.b, this.x[this.k + 11], this.S23, 643717713), this.b = this.GG(this.b, this.c, this.d, this.a, this.x[this.k], this.S24, 3921069994), this.a = this.GG(this.a, this.b, this.c, this.d, this.x[this.k + 5], this.S21, 3593408605), this.d = this.GG(this.d, this.a, this.b, this.c, this.x[this.k + 10], this.S22, 38016083), this.c = this.GG(this.c, this.d, this.a, this.b, this.x[this.k + 15], this.S23, 3634488961), this.b = this.GG(this.b, this.c, this.d, this.a, this.x[this.k + 4], this.S24, 3889429448), this.a = this.GG(this.a, this.b, this.c, this.d, this.x[this.k + 9], this.S21, 568446438), this.d = this.GG(this.d, this.a, this.b, this.c, this.x[this.k + 14], this.S22, 3275163606), this.c = this.GG(this.c, this.d, this.a, this.b, this.x[this.k + 3], this.S23, 4107603335), this.b = this.GG(this.b, this.c, this.d, this.a, this.x[this.k + 8], this.S24, 1163531501), this.a = this.GG(this.a, this.b, this.c, this.d, this.x[this.k + 13], this.S21, 2850285829), this.d = this.GG(this.d, this.a, this.b, this.c, this.x[this.k + 2], this.S22, 4243563512), this.c = this.GG(this.c, this.d, this.a, this.b, this.x[this.k + 7], this.S23, 1735328473), this.b = this.GG(this.b, this.c, this.d, this.a, this.x[this.k + 12], this.S24, 2368359562), this.a = this.HH(this.a, this.b, this.c, this.d, this.x[this.k + 5], this.S31, 4294588738), this.d = this.HH(this.d, this.a, this.b, this.c, this.x[this.k + 8], this.S32, 2272392833), this.c = this.HH(this.c, this.d, this.a, this.b, this.x[this.k + 11], this.S33, 1839030562), this.b = this.HH(this.b, this.c, this.d, this.a, this.x[this.k + 14], this.S34, 4259657740), this.a = this.HH(this.a, this.b, this.c, this.d, this.x[this.k + 1], this.S31, 2763975236), this.d = this.HH(this.d, this.a, this.b, this.c, this.x[this.k + 4], this.S32, 1272893353), this.c = this.HH(this.c, this.d, this.a, this.b, this.x[this.k + 7], this.S33, 4139469664), this.b = this.HH(this.b, this.c, this.d, this.a, this.x[this.k + 10], this.S34, 3200236656), this.a = this.HH(this.a, this.b, this.c, this.d, this.x[this.k + 13], this.S31, 681279174), this.d = this.HH(this.d, this.a, this.b, this.c, this.x[this.k], this.S32, 3936430074), this.c = this.HH(this.c, this.d, this.a, this.b, this.x[this.k + 3], this.S33, 3572445317), this.b = this.HH(this.b, this.c, this.d, this.a, this.x[this.k + 6], this.S34, 76029189), this.a = this.HH(this.a, this.b, this.c, this.d, this.x[this.k + 9], this.S31, 3654602809), this.d = this.HH(this.d, this.a, this.b, this.c, this.x[this.k + 12], this.S32, 3873151461), this.c = this.HH(this.c, this.d, this.a, this.b, this.x[this.k + 15], this.S33, 530742520), this.b = this.HH(this.b, this.c, this.d, this.a, this.x[this.k + 2], this.S34, 3299628645), this.a = this.II(this.a, this.b, this.c, this.d, this.x[this.k], this.S41, 4096336452), this.d = this.II(this.d, this.a, this.b, this.c, this.x[this.k + 7], this.S42, 1126891415), this.c = this.II(this.c, this.d, this.a, this.b, this.x[this.k + 14], this.S43, 2878612391), this.b = this.II(this.b, this.c, this.d, this.a, this.x[this.k + 5], this.S44, 4237533241), this.a = this.II(this.a, this.b, this.c, this.d, this.x[this.k + 12], this.S41, 1700485571), this.d = this.II(this.d, this.a, this.b, this.c, this.x[this.k + 3], this.S42, 2399980690), this.c = this.II(this.c, this.d, this.a, this.b, this.x[this.k + 10], this.S43, 4293915773), this.b = this.II(this.b, this.c, this.d, this.a, this.x[this.k + 1], this.S44, 2240044497), this.a = this.II(this.a, this.b, this.c, this.d, this.x[this.k + 8], this.S41, 1873313359), this.d = this.II(this.d, this.a, this.b, this.c, this.x[this.k + 15], this.S42, 4264355552), this.c = this.II(this.c, this.d, this.a, this.b, this.x[this.k + 6], this.S43, 2734768916), this.b = this.II(this.b, this.c, this.d, this.a, this.x[this.k + 13], this.S44, 1309151649), this.a = this.II(this.a, this.b, this.c, this.d, this.x[this.k + 4], this.S41, 4149444226), this.d = this.II(this.d, this.a, this.b, this.c, this.x[this.k + 11], this.S42, 3174756917), this.c = this.II(this.c, this.d, this.a, this.b, this.x[this.k + 2], this.S43, 718787259), this.b = this.II(this.b, this.c, this.d, this.a, this.x[this.k + 9], this.S44, 3951481745), this.a = this.AddUnsigned(this.a, this.AA), this.b = this.AddUnsigned(this.b, this.BB), this.c = this.AddUnsigned(this.c, this.CC), this.d = this.AddUnsigned(this.d, this.DD);
        return (this.WordToHex(this.a) + this.WordToHex(this.b) + this.WordToHex(this.c) + this.WordToHex(this.d)).toLowerCase()
      }, t.x = Array(), t.S11 = 7, t.S12 = 12, t.S13 = 17, t.S14 = 22, t.S21 = 5, t.S22 = 9, t.S23 = 14, t.S24 = 20, t.S31 = 4, t.S32 = 11, t.S33 = 16, t.S34 = 23, t.S41 = 6, t.S42 = 10, t.S43 = 15, t.S44 = 21, t.RotateLeft = function (t, e) {
        return t << e | t >>> 32 - e
      }, t.F = function (t, e, r) {
        return t & e | ~t & r
      }, t.G = function (t, e, r) {
        return t & r | e & ~r
      }, t.H = function (t, e, r) {
        return t ^ e ^ r
      }, t.I = function (t, e, r) {
        return e ^ (t | ~r)
      }, t
    }(),
    nt = A();

  function at() {
    var t = getCurrentPages() || "";
    return t[t.length - 1] || ""
  }

  function ht(t) {
    var e = "/";
    try {
      var r = at();
      if (!r) return r;
      var i, o = r.route,
        s = r.options || {};
      for (var n in i = r.options || {}, e = o + "?", s) {
        if ("share" !== t || "txsrShareInfoSdk" !== n)
          if (m(n))
            if (i[n]) e += n + "=" + s[n] + "&"
      }
      e = e.substring(0, e.length - 1)
    } catch (t) {
      console.error("getCurrentPageUrlWithArgs error", t)
    }
    return e
  }

  function ct(t) {
    try {
      var e = at();
      if (!e) return e;
      e.options;
      return (e.options || {})[t] || ""
    } catch (t) {
      console.error("getCurrentPageKey error", t)
    }
    return "/"
  }

  function ut() {
    var t = at();
    try {
      var e = __wxConfig.global.window.navigationBarTitleText;
      return (t ? (__wxConfig.page[t.route + ".html"].window || {}).navigationBarTitleText : "") || e || "\u672a\u77e5"
    } catch (t) { }
    return "\u672a\u77e5"
  }

  function dt() {
    return "devtools" === function () {
      try {
        return "undefined" == typeof __wxConfig ? "" : __wxConfig.platform
      } catch (t) {
        console.error("getEnv failed: ", t)
      }
      return ""
    }()
  }

  function pt(t, e, i) {
    try {
      var o = t[0],
        s = void 0 === o ? {} : o;
      if (s) switch (s.type) {
        case "tap":
        case "longpress":
        case "longtap":
        case "confirm":
          track.tapEventTrack("#" + i, 0, '', s.type);
          var n = (s.currentTarget || {}).dataset,
            a = void 0 === n ? {} : n;
          0 == Object.keys(a).length && (a = s.target.dataset);
          var h = this || {},
            c = h.is,
            u = void 0 === c ? "" : c;
          h.data;
          e("element", r({
            is_sdk_auto_track: !0,
            is: u,
            type: s.type,
            element_id: "#" + i
          }, a))
      }
    } catch (t) {
      console.error("elementEventTrack error", t)
    }
  }

  function ft() {
    var t, e = (at() || {}).route || "";
    try {
      t = nt.getStorageSync(O + "_production")
    } catch (t) {
      console.error("CacheManager.get error", t)
    }
    var r = t.USER_INFO || {},
      i = r.local_id,
      o = r.txsr_from_share_info,
      s = void 0 === o ? {} : o,
      n = s.mi,
      a = void 0 === n ? "" : n,
      h = s.d,
      c = void 0 === h ? 0 : h,
      u = s.o,
      d = void 0 === u ? "" : u,
      p = st.init(i + e),
      f = "" !== a && p === a ? c : c + 1;
    return a = st.init(i + e), 0 === c && (d = a), JSON.stringify({
      mi: a,
      d: f,
      o: d
    })
  }

  function lt(t) {
    return ["qqFriends", "qzone", "frist", "friends", "timeline", "recentContact"][parseInt(t)] || "friends"
  }
  var _t = "";
  try {
    _t = "1.7.3"
  } catch (t) { }
  var gt = function () {
    function t() {
      var t = this;
      this.env = "production", this.cachePrefix = O, this.inited = !1, this.option = {}, this.context = {
        idenTifier: "-------"
      }, this.idenTifierChanArr = M, this.idenTifierUserArr = z, this.reportState = q, this.needCheckUrlInfo = [], this.autoProxyData = {}, this.remoteConfigInfo = {
        masterSwitch: !0,
        isOpenProxyWxApi: !1
      }, this.openTrack = function () {
        var t = this;
        this.checkFallback(), this.option.autoStart && this.startReport(), setTimeout((function () {
          t.trackLogEvents()
        }), 999)
      }, this.initRemoteConfig = function () {
        try {
          var t = this;
          wx.request({
            url: "https://zhls.qq.com/open/sdk?token=" + this.option.token,
            data: {},
            header: {
              "content-type": "json"
            },
            success: function (e) {
              try {
                var r = e.data;
                if (t.remoteConfigInfo = y(t.remoteConfigInfo, r), t.track("sdk_config_info", {
                  _sdk_config_info: t.remoteConfigInfo
                }), !t.remoteConfigInfo.masterSwitch) return;
                t.openTrack(), t.remoteConfigInfo.isOpenProxyWxApi && t.openProxyWxApi()
              } catch (e) {
                t.track("sdk_error_log", {
                  _sdk_error_log: {
                    message: "request proxyConfig success",
                    type: N,
                    error: e.message
                  }
                }), t.openTrack()
              }
            },
            fail: function (e) {
              console.log("request proxyConfig error\uff1a", e), t.track("sdk_error_log", {
                _sdk_error_log: {
                  message: "request proxyConfig fail, url: https://zhls.qq.com/open/sdk?token=" + t.option.token,
                  type: N,
                  error: e.errMsg
                }
              }), t.openTrack()
            }
          })
        } catch (t) {
          console.log("request proxyConfig error\uff1a", t), this.track("sdk_error_log", {
            _sdk_error_log: {
              message: "request proxyConfig error, url: https://zhls.qq.com/open/sdk?token=" + this.option.token,
              type: N,
              error: t.message
            }
          }), this.openTrack()
        }
      }, this.openProxyWxApi = function () {
        var t = this;
        try {
          var e = r({}, this.remoteConfigInfo);
          if (delete e.masterSwitch, delete e.isOpenProxyWxApi, !Object.keys(e).length) return;
          Object.keys(e).forEach((function (r) {
            t.autoProxyData[r] = {}, e[r].forEach((function (e) {
              t.autoProxyData[r][e.name] = {
                _sr_track_url: "",
                _sr_track_body: ""
              }, e.value.forEach((function (i) {
                t.needCheckUrlInfo.push({
                  name: e.name,
                  url: i.url,
                  eventName: r,
                  grabLocation: i.grabLocation
                })
              }))
            }))
          }))
        } catch (t) {
          this.track("sdk_error_log", {
            _sdk_error_log: {
              message: "openProxyWxApi error",
              type: N,
              error: t.message
            }
          }), console.warn("SDK\u4e0b\u53d1\u914d\u7f6e\u63a5\u53e3\u62a5\u9519\uff1a", t)
        }
      }, this.hackAutoTrack = function () {
        var t = this;
        V({
          success: function (e, r) {
            t.remoteConfigInfo.isOpenProxyWxApi && t.checkRequestUrl(r.url).forEach((function (i) {
              var o;
              if ("request" === i.grabLocation) {
                var s = function (t) {
                  var e = "";
                  void 0 === t ? e = decodeURI(location.search) : t.split("?").length > 1 && (e = "?" + t.split("?")[1]);
                  var r = new Object;
                  if (-1 != e.indexOf("?"))
                    for (var i = e.substr(1).split("&"), o = 0; o < i.length; o++) r[i[o].split("=")[0]] = decodeURI(i[o].split("=")[1]);
                  return r
                }(r.url);
                o = y(s, r.data)
              } else o = e.data;
              t.autoProxyData[i.eventName][i.name]._sr_track_body = o, t.autoProxyData[i.eventName][i.name]._sr_track_url = i.url, t.ckObjectFullFill(i.eventName) && ("custom_order" == i.eventName ? t.track(i.eventName, {
                is_sdk_auto_track: !0,
                _auto_proxy_data: t.formatAutoData(i.eventName),
                order: {
                  order_time: Number((new Date).getTime()),
                  order_status: "give_order"
                }
              }) : t.track(i.eventName, {
                is_sdk_auto_track: !0,
                _auto_proxy_data: t.formatAutoData(i.eventName)
              }), t.clearProxyData(i.eventName))
            }))
          }
        }, this.track.bind(this)), rt({
          onStart: function () {
            t.remoteConfigInfo.isOpenProxyWxApi && (t.ckObjectFullFill("custom_order") ? t.track("custom_order", {
              is_sdk_auto_track: !0,
              _auto_proxy_data: t.formatAutoData("custom_order"),
              order: {
                order_time: Number((new Date).getTime()),
                order_status: "pay"
              }
            }) : t.track("sdk_error_log", {
              _sdk_error_log: {
                message: "custom_order error",
                type: G,
                error: "Incomplete order"
              }
            }))
          },
          success: function () {
            t.remoteConfigInfo.isOpenProxyWxApi && t.ckObjectFullFill("custom_order") && (t.track("custom_order", {
              is_sdk_auto_track: !0,
              _auto_proxy_data: t.formatAutoData("custom_order"),
              order: {
                order_time: Number((new Date).getTime()),
                order_status: "payed"
              }
            }), t.clearProxyData("custom_order"))
          },
          fail: function () {
            t.remoteConfigInfo.isOpenProxyWxApi && t.ckObjectFullFill("custom_order") && t.track("custom_order", {
              is_sdk_auto_track: !0,
              _auto_proxy_data: t.formatAutoData("custom_order"),
              order: {
                order_time: Number((new Date).getTime()),
                order_status: "cancel_pay"
              }
            })
          }
        }, this.track.bind(this))
      }, this.clearProxyData = function (t) {
        var e = this,
          r = Object.keys(this.autoProxyData[t]);
        0 !== r.length && r.forEach((function (r) {
          try {
            e.autoProxyData[t][r]._sr_track_url = "", e.autoProxyData[t][r]._sr_track_body = ""
          } catch (t) {
            e.track("sdk_error_log", {
              _sdk_error_log: {
                message: "clearProxyData error",
                type: N,
                error: t.message
              }
            }), console.log("clearProxyData error", t)
          }
        }))
      }, this.ckObjectFullFill = function (t) {
        var e = this;
        if (void 0 === this.autoProxyData[t]) return !1;
        var r = Object.keys(this.autoProxyData[t]);
        if (0 === r.length) return !1;
        var i = !0;
        return r.forEach((function (r) {
          try {
            "" == e.autoProxyData[t][r]._sr_track_body && (i = !1)
          } catch (t) {
            e.track("sdk_error_log", {
              _sdk_error_log: {
                message: "ckObjectFullFill error",
                type: N,
                error: t.message
              }
            }), console.log("error ckObjectFullFill", t)
          }
        })), i
      }, this.checkRequestUrl = function (t) {
        var e = [];
        return this.needCheckUrlInfo.forEach((function (i) {
          t.includes(i.url) && e.push(r({}, i))
        })), e
      }, this.formatAutoData = function (t) {
        var e = this,
          i = r({}, this.autoProxyData[t]);
        return Object.keys(i).forEach((function (t) {
          try {
            i[t] = f.encode(JSON.stringify(i[t]))
          } catch (t) {
            e.track("sdk_error_log", {
              _sdk_error_log: {
                message: "formatAutoData error",
                type: N,
                error: t.message
              }
            }), console.log("error formatAutoData", t)
          }
        })), i
      }, this.triggerFlush = g((function () {
        t.checkAndUpload()
      }), 1e3), this.eventDataFmatter = function (e) {
        var i = +new Date,
          o = t.getPageInfo();
        if (void 0 !== t._onQueue) {
          var s = t._onQueue(e);
          l(e) ? e = s : console.warn("eventDataFmatter should return Object type")
        }
        return r(r(r({}, o), e), {
          time: i
        })
      }, this.checkRequiredOptionItem = function () {
        return !!t.option.token || (t.option.skipTokenCheck ? (console.warn("token \u672a\u914d\u7f6e\uff0c\u5df2\u8df3\u8fc7\u8be5\u68c0\u67e5"), !0) : (console.error("sdk.init - Option \u5fc5\u8981\u53c2\u6570\u914d\u7f6e\u7f3a\u5931\uff0c\u8bf7\u68c0\u67e5"), !1))
      }, this.checkVersionInfo = function () {
        if (t.setContext({
          sr_sdk_version: t.version
        }), t.isDev()) {
          var e = "https://mp.zhls.qq.com/sdk/sr-sdk-version-info.json?timesamp=" + Date.now();
          return t.request({}, {
            url: e,
            method: "GET"
          }).then((function (e) {
            var r = (e.data || {})[t.name],
              i = !0;
            if (r) return t.version && (1 === I(r.version.min, t.version) ? (console.error("\u5f53\u524dSDK\u7248\u672c\u8fc7\u4f4e, \u8bf7\u5347\u7ea7\uff01"), i = !1) : 1 === I(r.version.max, t.version) && console.warn("\u5f53\u524dSDK\u6709\u66f4\u65b0, \u63a8\u8350\u5347\u7ea7\uff01")), {
              success: i,
              data: r,
              msg: ""
            }
          })).catch((function (t) {
            return void 0 === t && (t = {}), {
              success: !1,
              data: void 0,
              msg: t.errMsg
            }
          }))
        }
      }, this.queueInitialize = function () {
        var e = t.getServerUrl();
        return t.queue = new C({
          request: function (i) {
            var o = i.events.map((function (e) {
              return r(r({}, e), {
                from: "sr-sdk-wxapp",
                tracking_id: t.tracking_id,
                log_id: ++t.log_id
              })
            }));
            return t.setCache(P, {
              last_tracking_id: t.tracking_id,
              last_max_log_id: t.log_id
            }), t.request(o, {
              url: e,
              method: "POST"
            }).catch((function (t) {
              return console.error("APICaller error", t), "request:fail url not in domain list" === t.msg ? r(r({}, t), {
                success: !0
              }) : t
            }))
          }
        }), !0
      }, this.trackLogEvents = function () {
        var e = t.getCache(P) || {};
        return e.last_max_log_id ? (t.track("logid_events", e), !0) : (++t.log_id, !1)
      }, this.tracking_id = v(), this.log_id = -1, this.checkStaticMethods()
    }
    return t.prototype.init = function (t) {
      if (this.inited) return this;
      var e, r = wx.getStorageSync("__SR_SDK_TRACKER___production"),
        i = r && r.USER_INFO && r.USER_INFO.app_id || "";
      if (i && i !== this.option.appid && wx.removeStorageSync("__SR_SDK_TRACKER___production"), this.version = _t || "", this.option = y(this.defaultOptions, this.option, t), t.autoProxy && (this.option.proxyComponent = !0, this.option.proxyPage = !0, this.option.openAutoTrackOpenId = !0, this.option.openAutoTrackUnionId = !0, this.option.autoTrack = !0, this.option.openSdkShareDepth = !0), !this.checkRequiredOptionItem()) return this;
      this.cacheManagerInitialize();
      try {
        this.proxyInitialize()
      } catch (t) {
        this.errorHandle(t)
      }
      return this.queueInitialize(), this.contextInitialize(), this.inited = !0, this.checkVersionInfo(), this.initRemoteConfig(), this.hackAutoTrack(), this.option.openErrorMonitoring && (e = this.track.bind(this), Q.onError((function (t) {
        t && e("sdk_error_log", {
          _sdk_error_log: {
            message: "JS_RUN_ERROR",
            type: j,
            error: t
          }
        })
      })), V({
        complete: function (t, r) {
          var i = t.errMsg,
            o = t.statusCode,
            s = t.data,
            n = "";
          i.indexOf("timeout") > -1 ? n = "timeout" : i.indexOf("fail") > -1 ? n = "failed" : o ? o < 0 ? n = "failed" : o >= 400 && (n = "error") : n = "failed", n && e("sdk_error_log", {
            _sdk_error_log: {
              message: "AJAX_ERROR",
              type: H,
              error: "AJAX_ERROR: request " + n + "\n                    \nres status: " + (o || 0) + "\n                    \nres duration: " + (Date.now() - r.requestStartTime) + "\n                    \nres data: " + w(s) + "\n                    \nreq url: " + r.url + "\n                    \nreq method: " + (r.method || "get") + "\n                    \nreq param: " + w(r.data) + "\n                    \nerrMsg: " + i.slice(0, 1e3)
            }
          })
        }
      }, e)), this
    }, t.prototype.track = function (t, e) {
      if (this.remoteConfigInfo.masterSwitch) {
        var r = this.option.debug;
        JSON.stringify(e || {}).length > 5e3 && console.warn("\u76d1\u6d4b\u5230\u8d85\u8fc75000\u7684\u4e0a\u62a5\u65e5\u5fd7\uff1a" + t);
        var i = this.eventDataFmatter(e);
        return r && console && "function" == typeof console.log && console.log("\u3010Track\u3011 " + t, i), this.queue.add({
          type: t,
          props: i
        }), this.queue.checkQueue(), (this.queue.getItems().length || 0) > 9 && this.reportState === F ? this.flush() : this.triggerFlush(), this
      }
    }, t.prototype.setContext = function (t, e, i) {
      return void 0 === e && (e = 0), void 0 === i && (i = !1), console.warn("setContext \u4e0d\u5728\u63a8\u8350\u4f7f\u7528\uff0c\u8bf7\u7528\u66f4\u8f7b\u4fbf\u7684 setUser\u3001setChan\u7b49\u65b9\u6cd5\u4ee3\u66ff"), i && this.flush(), this.context = r(r(r({}, this.context), t), {
        wx_user: r(r({}, this.context.wx_user), t.wx_user || {}),
        chan: r(r({}, this.context.chan), t.chan || {})
      }), this.setIdenTifier({
        value: r({}, t),
        type: "context",
        isSr: e
      }), this
    }, t.prototype.setUser = function (t, e, i) {
      return void 0 === t && (t = {}), void 0 === e && (e = 0), void 0 === i && (i = !1), i && this.flush(), this.context = Object.assign({}, this.context, {
        wx_user: r(r({}, this.context.wx_user), t)
      }), this.setIdenTifier({
        value: r({}, t),
        type: "user",
        isSr: e
      }), this.setCache(R, this.context.wx_user), this
    }, t.prototype.setChan = function (t, e, i) {
      void 0 === e && (e = 0), void 0 === i && (i = !1), i && this.flush();
      var o = t.chan_id,
        s = (this.context.chan || {}).chan_id;
      return this.context = Object.assign({}, this.context, {
        chan: r(r(r({}, this.context.chan), t), {
          chan_id: o || (s || "")
        })
      }), this.setIdenTifier({
        value: r({}, t),
        type: "chan",
        isSr: e
      }), this
    }, t.prototype.setComponent = function (t) {
      var e = t.component_id,
        i = t.component_name;
      return this.context = Object.assign({}, this.context, {
        component: r(r({}, t), {
          component_id: e,
          component_name: i
        })
      }), this
    }, t.prototype.clearComponent = function () {
      return delete this.context.component, this
    }, t.prototype.setActivityInfo = function (t) {
      var e = t.activity_id,
        i = t.activity_name,
        o = t.activity_type,
        s = t.activity_index;
      return this.context = Object.assign({}, this.context, {
        activity_info: r(r({}, t), {
          activity_id: e,
          activity_name: i,
          activity_type: o,
          activity_index: s
        })
      }), this
    }, t.prototype.clearActivityInfo = function () {
      return delete this.context.activity_info, this
    }, t.prototype.startReport = function () {
      return this.reportState = F, this.triggerFlush(), this
    }, t.prototype.resumeReport = function () {
      var t = this.getCache(T) || [];
      return this.queue.unshift(t), this.reportState === D && (this.reportState = F), this.triggerFlush(), this
    }, t.prototype.pauseReport = function () {
      return this.reportState = D, this.setCache(T, this.queue.clean()), this
    }, t.prototype.flush = function () {
      return this.queue.flush(this.context, this.getCache(U)), this
    }, t.prototype.onQueue = function (t) {
      return this._onQueue = t, this
    }, t.prototype.getInfo = function () {
      var t = {
        option: this.option,
        tracking_id: this.tracking_id,
        context: this.context,
        is_dev: this.isDev()
      };
      return "SR_SDK_INFO=" + f.encode(JSON.stringify(t))
    }, t.prototype.getLocalId = function () {
      return this.context.wx_user.local_id || ""
    }, t.prototype.getWxUserInfo = function () {
      return r({}, this.context.wx_user)
    }, t.prototype.getChanInfo = function () {
      return r({}, this.context.chan)
    }, t.prototype.getPagePathInfo = function () {
      return ht() || ""
    }, t.prototype.checkStaticMethods = function () {
      if ("development" === this.env) try {
        var t = this.constructor;
        ["create"].forEach((function (e) {
          !t[e] && console.error("static " + e + " should be implement")
        }))
      } catch (t) {
        console.error("checkStaticMethods error", t)
      }
    }, t.prototype.checkFallback = function () {
      var t = this;
      setTimeout((function () {
        t.checkAndUpload(), t.checkFallback()
      }), 1e4)
    }, t.prototype.checkAndUpload = function () {
      this.reportState === F && this.flush()
    }, t.prototype.contextInitialize = function () {
      var t = this.getUser(),
        e = this.getSystemInfo(),
        i = e.brand,
        o = e.model,
        s = e.version,
        n = e.environment,
        a = e.screenWidth,
        h = e.screenHeight,
        c = e.system,
        u = e.platform,
        d = e.SDKVersion,
        p = e.benchmarkLevel,
        f = e.locationReducedAccuracy,
        l = this.getFrameworkInfo();
      this.context = y(this.context, {
        wx_user: r(r({}, t), {
          app_id: this.option.appid
        }),
        system_info: {
          brand: i,
          model: o,
          version: s,
          environment: n,
          screenWidth: a,
          screenHeight: h,
          system: c,
          platform: u,
          SDKVersion: d,
          benchmarkLevel: p,
          LRA: f
        },
        framework_info: l,
        chan: {}
      }), this.setIdenTifier({
        value: {
          app_id: this.option.appid
        },
        type: "user",
        isSr: 1
      })
    }, t.prototype.rleitrValue = function (t, e, r) {
      var i = t.split("");
      return i[e] = r, i.join("")
    }, t.prototype.setuserchanItr = function (t, e, r) {
      var i = this,
        o = this.getCache(U) || "-----";
      Object.keys(t).forEach((function (t, s) {
        "user" === e && -1 !== i.idenTifierUserArr.indexOf(t) && i.setCache(U, i.rleitrValue(o, i.idenTifierUserArr.indexOf(t), r)), "chan" === e && -1 !== i.idenTifierChanArr.indexOf(t) && (i.context.idenTifier = i.rleitrValue(i.context.idenTifier, i.idenTifierChanArr.indexOf(t), r))
      }))
    }, t.prototype.setcontextItr = function (t, e) {
      t.wx_user && this.setuserchanItr(r({}, t.wx_user), "user", e), t.chan && this.setuserchanItr(r({}, t.chan), "chan", e), delete t.wx_user, delete t.chan, this.setuserchanItr(r({}, t), "chan", e)
    }, t.prototype.setIdenTifier = function (t) {
      var e = t.value,
        r = t.type,
        i = t.isSr;
      switch (r) {
        case "context":
          this.setcontextItr(e, i);
          break;
        default:
          this.setuserchanItr(e, r, i)
      }
    }, t.prototype.getUser = function () {
      var t = this.context.wx_user || this.getCache(R) || {};
      return t.local_id && 50 === t.local_id.length || (t = {
        local_id: v()
      }, this.setIdenTifier({
        value: r({}, t),
        type: "user",
        isSr: 1
      }), this.setCache(R, t)), t
    }, t.prototype.cacheManagerInitialize = function () {
      var t = this.getCacheManager();
      this.cacheManager = t
    }, t.prototype.getCache = function (t) {
      return this.cacheManager ? (this.cacheManager.get(O) || {})[t] : (console.error(E.MISS), {})
    }, t.prototype.setCache = function (t, e) {
      var i;
      this.cacheManager || console.error(E.MISS);
      var o = r(r({}, this.cacheManager.get(O) || {}), ((i = {})[t] = e, i));
      this.cacheManager.set(O, o)
    }, t.prototype.getServerUrl = function () {
      var t = "";
      return t = "function" == typeof this.option.serverUrl ? this.option.serverUrl.call(this) : this.option.serverUrl || "https://zhls.qq.com/api/report", t += "?token=" + this.option.token
    }, t.prototype.getTrackingId = function () {
      return this.tracking_id
    }, i([it], t.prototype, "init", null), i([it, ot], t.prototype, "track", null), i([it, ot], t.prototype, "setContext", null), i([it, ot], t.prototype, "setUser", null), i([it, ot], t.prototype, "setChan", null), i([it, ot], t.prototype, "setComponent", null), i([it, ot], t.prototype, "clearComponent", null), i([it, ot], t.prototype, "setActivityInfo", null), i([it, ot], t.prototype, "clearActivityInfo", null), i([it, ot], t.prototype, "startReport", null), i([it, ot], t.prototype, "resumeReport", null), i([it, ot], t.prototype, "pauseReport", null), i([it, ot], t.prototype, "flush", null), i([it, ot], t.prototype, "onQueue", null), i([it, ot], t.prototype, "getInfo", null), i([it, ot], t.prototype, "getLocalId", null), i([it, ot], t.prototype, "getWxUserInfo", null), i([it, ot], t.prototype, "getChanInfo", null), i([it, ot], t.prototype, "getPagePathInfo", null), t
  }();

  function vt(t, e, r, i) {
    void 0 === i && (i = !1);
    var s = t[e];
    t[e] = function () {
      for (var t = arguments, e = this, n = [], a = 0; a < arguments.length; a++) n[a] = t[a];
      var h = function () {
        return s && s.apply(e, n)
      };
      return i && (h = function () {
        return Promise.resolve().then((function () {
          return s.apply(e, n)
        }))
      }), r.apply(this, o([h], n))
    }
  }
  var yt = function () { },
    mt = {},
    kt = {},
    xt = function () {
      return (new Date).getTime()
    };
  var St = function (t, e, r, i, o) {
    return function (s) {
      return function (t, e, r, i, o, s) {
        if (vt(t, "onLoad", (function (t, e) {
          t(), this.lauchTime = xt()
        })), vt(t, "onShow", (function (t) {
          var i = this,
            o = function () {
              i.showTime = xt();
              var t = ct.call(i, "room_id") || ct.call(i, "roomId") || ct.call(i, "roomid");
              t && r({
                room_id: t
              }, 1), e("browse_wxapp_page", {
                is_sdk_auto_track: !0,
                refer_page: kt.route,
                is_newly_open: !mt[i.route]
              }), mt[i.route] = !0
            };
          t().then(o).catch(o)
        }), !0), vt(t, "onHide", (function (t) {
          t();
          var r = this.showTime ? xt() - this.showTime : 0;
          r = r > 144e5 ? 0 : r, this.showTime = 0, e("leave_wxapp_page", {
            is_sdk_auto_track: !0,
            refer_page: kt.route,
            stay_time: r
          }), kt = this, i({
            refer_page: this.route
          })
        })), vt(t, "onUnload", (function (t) {
          t();
          var r = this.showTime ? xt() - this.showTime : 0;
          r = r > 144e5 ? 0 : r, e("leave_wxapp_page", {
            is_sdk_auto_track: !0,
            refer_page: kt.route,
            stay_time: r
          }), kt = this, i({
            refer_page: this.route
          })
        })), vt(t, "onPullDownRefresh", (function (t) {
          t(), e("page_pull_down_refresh", {
            is_sdk_auto_track: !0
          })
        })), vt(t, "onReachBottom", (function (t) {
          t(), e("page_reach_bottom", {
            is_sdk_auto_track: !0
          })
        })), "function" == typeof t.onShareAppMessage) {
          var n = t.onShareAppMessage || yt;
          if (t.onShareAppMessage = function (t) {
            void 0 === t && (t = {});
            var r = n.call(this, t) || {};
            try {
              var i = r.path || ht.call(this, "share"); - 1 === i.indexOf("?") ? i += "?" : "&" !== i.slice(-1) && (i += "&");
              var o = void 0,
                a = void 0;
              s && (o = ft(), a = JSON.parse(o), i = i + "txsrShareInfoSdk=" + encodeURIComponent(o)), e("page_share_app_message", {
                is_sdk_auto_track: !0,
                from_type: t.from || "\u672a\u77e5",
                share_to: lt(t.shareTarget),
                share_path: i,
                share_title: r.title,
                share_image_url: r.imageUrl,
                refer_page: kt.route,
                txsr_share_info_sdk: a
              }), r.path = i
            } catch (t) {
              console.error("onShareAppMessage error", t)
            }
            return r
          }, "function" == typeof t.onShareTimeline) {
            var a = t.onShareTimeline || yt;
            t.onShareTimeline = function (t) {
              void 0 === t && (t = {});
              var r = a.call(this, t) || {};
              try {
                var i = r.path || ht.call(this, "share"),
                  o = r.query || ""; - 1 === i.indexOf("?") ? i += "?" : "&" !== i.slice(-1) && (i += "&");
                var n = void 0,
                  h = void 0;
                s && (n = ft(), h = JSON.parse(n), i = i + "txsrShareInfoSdk=" + encodeURIComponent(n)), e("page_share_app_message", {
                  is_sdk_auto_track: !0,
                  from_type: t.from || "\u672a\u77e5",
                  share_to: "timeline",
                  query: o,
                  share_path: i,
                  share_title: r.title,
                  share_image_url: r.imageUrl,
                  refer_page: kt.route,
                  txsr_share_info_sdk: h
                }), r.path = i
              } catch (t) {
                console.error("onShareAppMessage error", t)
              }
              return r
            }
          }
        }
        return o && Object.entries(t).filter((function (t) {
          var e = t[0];
          t[1];
          return !["onLoad", "onShow", "onReady", "onHide", "onUnload", "onPullDownRefresh", "onReachBottom", "onPageScroll", "onShareAppMessage", "onResize", "onTabItemTap"].includes(e)
        })).forEach((function (r) {
          var i = r[0];
          "function" == typeof r[1] && vt(t, i, (function (t) {
            for (var r = arguments, o = [], s = 1; s < arguments.length; s++) o[s - 1] = r[s];
            return pt.call(this, o, e, i), t()
          }))
        })), t
      }(s, t, e, r, i, o)
    }
  },
    bt = function () { },
    It = {},
    wt = {},
    At = function () {
      return (new Date).getTime()
    };
  var Ct = function (t, e, r, i, o) {
    return function (s) {
      return function (t, e, r, i, o, s) {
        try {
          if (t.methods = t.methods || {}, vt(t.methods, "onLoad", (function (t, e) {
            t(), this.lauchTime = At()
          })), vt(t.methods, "onShow", (function (t) {
            var i = this,
              o = function () {
                i.showTime = At();
                var t = ct.call(i, "room_id") || ct.call(i, "roomId") || ct.call(i, "roomid");
                t && r({
                  room_id: t
                }, 1), e("browse_wxapp_page", {
                  is_sdk_auto_track: !0,
                  refer_page: wt.route,
                  is_newly_open: !It[i.route]
                }), It[i.route] = !0
              };
            t().then(o).catch(o)
          }), !0), vt(t.methods, "onUnload", (function (t) {
            t();
            var r = this.showTime ? At() - this.showTime : 0;
            r = r > 144e5 ? 0 : r, e("leave_wxapp_page", {
              is_sdk_auto_track: !0,
              refer_page: wt.route,
              stay_time: r
            }), wt = this, i({
              refer_page: this.route
            })
          })), vt(t.methods, "onPullDownRefresh", (function (t) {
            t(), e("page_pull_down_refresh", {
              is_sdk_auto_track: !0
            })
          })), vt(t.methods, "onReachBottom", (function (t) {
            t(), e("page_reach_bottom", {
              is_sdk_auto_track: !0
            })
          })), vt(t.methods, "onHide", (function (t) {
            t();
            var r = this.showTime ? At() - this.showTime : 0;
            r = r > 144e5 ? 0 : r, this.showTime = 0, e("leave_wxapp_page", {
              is_sdk_auto_track: !0,
              refer_page: wt.route,
              stay_time: r
            }), wt = this, i({
              refer_page: this.route
            })
          })), "function" == typeof t.methods.onShareAppMessage) {
            var n = t.methods.onShareAppMessage || bt;
            if (t.methods.onShareAppMessage = function (t) {
              void 0 === t && (t = {});
              var r = n.call(this, t) || {};
              try {
                var i = r.path || ht.call(this, "share"); - 1 === i.indexOf("?") ? i += "?" : "&" !== i.slice(-1) && (i += "&");
                var o = void 0,
                  a = void 0;
                s && (o = ft(), a = JSON.parse(o), i = i + "txsrShareInfoSdk=" + encodeURIComponent(o)), e("page_share_app_message", {
                  is_sdk_auto_track: !0,
                  from_type: t.from || "\u672a\u77e5",
                  share_to: "friends",
                  share_path: i,
                  share_title: r.title,
                  share_image_url: r.imageUrl,
                  refer_page: wt.route,
                  txsr_share_info_sdk: a
                }), r.path = i
              } catch (t) {
                console.error("onShareAppMessage error", t)
              }
              return r
            }, "function" == typeof t.methods.onShareTimeline) {
              var a = t.methods.onShareTimeline || bt;
              t.methods.onShareTimeline = function (t) {
                void 0 === t && (t = {});
                var r = a.call(this, t) || {};
                try {
                  var i = r.path || ht.call(this, "share"),
                    o = r.query || ""; - 1 === i.indexOf("?") ? i += "?" : "&" !== i.slice(-1) && (i += "&");
                  var n = void 0,
                    h = void 0;
                  s && (n = ft(), h = JSON.parse(n), i = i + "txsrShareInfoSdk=" + encodeURIComponent(n)), e("page_share_app_message", {
                    is_sdk_auto_track: !0,
                    from_type: t.from || "\u672a\u77e5",
                    share_to: lt(t.shareTarget),
                    share_path: i,
                    query: o,
                    share_title: r.title,
                    share_image_url: r.imageUrl,
                    refer_page: wt.route,
                    txsr_share_info_sdk: h
                  }), r.path = i
                } catch (t) {
                  console.error("onShareAppMessage error", t)
                }
                return r
              }
            }
          }
          t.methods && o && Object.entries(t.methods).filter((function (t) {
            var e = t[0];
            t[1];
            return !["onLoad", "onShow", "onReady", "onHide", "onUnload", "onPullDownRefresh", "onReachBottom", "onPageScroll", "onShareAppMessage", "onResize", "onTabItemTap", "observer"].includes(e)
          })).forEach((function (r) {
            var i = r[0];
            "function" == typeof r[1] && vt(t.methods, i, (function (t) {
              for (var r = arguments, o = [], s = 1; s < arguments.length; s++) o[s - 1] = r[s];
              return pt.call(this, o, e, i), t()
            }))
          }))
        } catch (t) {
          console.error("componentProxy error", t)
        }
        return t
      }(s, t, e, r, i, o)
    }
  },
    Ot = {},
    Tt = function (t) {
      return t
    },
    Rt = A(),
    Pt = function (t) {
      function i() {
        var e = t.call(this) || this;
        return e.name = "mp", e.component = Tt, e.page = Tt, e.proxySetNavigation = function () {
          try {
            var t = Rt.setNavigationBarTitle;
            Object.defineProperty(Rt, "setNavigationBarTitle", {
              get: function () {
                return function (e) {
                  void 0 === e && (e = {});
                  try {
                    var r = at();
                    try {
                      __wxConfig.page = __wxConfig.page || {}
                    } catch (t) {
                      console.error(t)
                    }
                    var i = __wxConfig.page[r.route + ".html"];
                    i && ((i.window || {}).navigationBarTitleText = e.title)
                  } catch (t) { }
                  t.call(this, e)
                }
              }
            })
          } catch (t) {
            console.warn("proxySetNavigation failed", t)
          }
        }, e.request = function (t, r) {
          var i = function (t) {
            return void 0 === t && (t = {}), 0 === t.code
          };
          return "function" == typeof e.option.onUploaded && (i = e.option.onUploaded), new Promise((function (e, o) {
            Rt.request({
              url: r.url,
              method: r.method || "POST",
              data: t,
              success: function (t) {
                void 0 === t && (t = {});
                var r = t.data,
                  o = void 0 === r ? {} : r,
                  s = i(o);
                e({
                  success: void 0 === s || s,
                  data: o.data || o,
                  msg: o.errMsg
                })
              },
              fail: function (t) {
                o({
                  success: !1,
                  data: void 0,
                  msg: t.errMsg
                })
              }
            })
          }))
        }, e.defaultOptions = {
          autoProxy: !1,
          autoStart: !0,
          debug: !1,
          usePlugin: !1,
          proxyPage: !1,
          proxyComponent: !1,
          autoTrack: !1,
          trackApp: !0,
          openSdkShareDepth: !1,
          installFrom: "",
          openAutoTrackOpenId: !1,
          openAutoTrackUnionId: !1,
          openErrorMonitoring: !1
        }, e.proxySetNavigation(), e
      }
      return e(i, t), i.prototype.getCacheManager = function () {
        var t = "" + this.env,
          e = function (e) {
            return e + "_" + t
          };
        return {
          get: function (t) {
            var r;
            try {
              r = Rt.getStorageSync(e(t))
            } catch (t) {
              return console.error("CacheManager.get error", t), r
            }
            return r
          },
          set: function (t, r) {
            try {
              Rt.setStorageSync(e(t), r)
            } catch (t) {
              return console.error("CacheManager.set error", t), !1
            }
            return !0
          }
        }
      }, i.prototype.proxyInitialize = function () {
        return Pt.options = this.option, this.trackApp(), !0
      }, i.prototype.trackApp = function () {
        var t = this,
          e = !1;
        Rt.onAppShow((function (i) {
          void 0 === i && (i = {});
          var o = i,
            s = o.query,
            n = void 0 === s ? {} : s,
            a = o.path,
            h = o.shareTicket,
            c = t.option.openSdkShareDepth,
            u = t.option.openAutoTrackOpenId,
            d = t.option.openAutoTrackUnionId,
            p = t.option.appid,
            f = function (t) {
              void 0 === t && (t = {});
              var e = {};
              if (t.scene) {
                try {
                  var i = decodeURIComponent(t.scene);
                  (i = i.replace("?", "").trim()).split("&").map((function (t) {
                    if (t) {
                      var r = t.split("="),
                        i = r[0],
                        o = r[1];
                      m(i) && (e[i] = void 0 === o || o)
                    }
                  }))
                } catch (t) {
                  console.error(t)
                }
                t = r(r({}, t), e)
              }
              return t
            }(n || {}),
            l = f.txsrShareInfoSdk || "{}",
            _ = t;
          if (f && "{}" !== JSON.stringify(f)) {
            var g = "?";
            Object.entries(f).forEach((function (t, e) {
              var r = t[0],
                i = t[1];
              g += (0 === e ? "" : "&") + r + "=" + i
            })), a += g
          }
          if (t.setChan(r(r({}, f), {
            chan_wxapp_scene: i.scene,
            chan_refer_app_id: (i.referrerInfo || {}).appId
          }), 1), f.chan_id && t.setChan({
            chan_id: f.chan_id
          }, 1), c && "{}" !== l) try {
            t.setUser({
              txsr_from_share_info: JSON.parse(decodeURIComponent(l))
            }, 1)
          } catch (t) { }
          e || (e = !0, t.option.trackApp && t.track("app_launch", {
            is_sdk_auto_track: !0,
            page: a
          }));
          var v = (t.cacheManager.get(O) || {}).USER_INFO || {},
            y = v.open_id,
            k = void 0 === y ? "" : y,
            x = v.union_id;
          if (u && !k || d && !(void 0 === x ? "" : x)) try {
            Rt.login({
              success: function (t) {
                var e = t.code;
                Rt.request({
                  url: "https://zhls.qq.com/wxlogin/getOpenId?appid=" + p + "&js_code=" + e,
                  data: {},
                  header: {
                    "content-type": "json"
                  },
                  success: function (t) {
                    var e = t.data,
                      r = e.openId,
                      i = e.unionId,
                      o = void 0 === i ? "" : i;
                    _.setUser({
                      open_id: r,
                      union_id: o
                    }, 1), c && h && r && _.getOpenGId(h, r)
                  }
                })
              }
            })
          } catch (e) {
            t.errorHandle(e)
          }
          c && h && k && t.getOpenGId(h, k), t.option.trackApp && t.track("app_show", {
            is_sdk_auto_track: !0,
            page: a
          })
        })), Rt.onAppHide((function () {
          t.option.trackApp && t.track("exit_wxapp", {
            is_sdk_auto_track: !0
          })
        }))
      }, i.prototype.getOpenGId = function (t, e) {
        var r = this.option.appid,
          i = this;
        Rt.getShareInfo({
          shareTicket: t,
          success: function (t) {
            var o = t.iv,
              s = t.encryptedData;
            Rt.request({
              url: "https://zhls.qq.com/wxlogin/convertData",
              data: {
                appid: r,
                openid: e,
                data: s,
                iv: o
              },
              header: {
                "content-type": "json"
              },
              success: function (t) {
                var e = (t && t.data).openGId;
                e && i.setChan({
                  openGId: e
                }, 1)
              }
            })
          },
          fail: function (t) { }
        })
      }, i.prototype.errorHandle = function (t) {
        try {
          var e = this.getServerUrl();
          this.request({
            type: "sdk api exec error",
            props: {
              sr_sdk_version: this.version,
              system_info: this.getSystemInfo(),
              framework_info: this.getFrameworkInfo(),
              message: t,
              stack: t
            }
          }, {
            url: e,
            method: "POST"
          })
        } catch (t) {
          console.log("errorHandle error", t)
        }
      }, i.prototype.getSystemInfo = function () {
        try {
          return Rt.getSystemInfoSync()
        } catch (t) {
          return {}
        }
      }, i.prototype.getFrameworkInfo = function () {
        var t, e;
        try {
          if (process && process.env && process.env.TARO_ENV && (t = "taro"), this.option.installFrom) {
            var r = String(this.option.installFrom).toLowerCase(),
              i = /^((taro)|(uni[\-]?app)|(chameleon)|(wepy)|(mpvue))(@v?([\S]*))?/g.exec(r);
            i && i[1] && ("taro" === t && i[2] ? e = i[8] : "taro" !== t && (e = i[8], t = i[3] ? "uni-app" : i[4] || i[5] || i[6] || "unknown"))
          }
        } catch (e) {
          t = "unknown"
        }
        return {
          framework: t,
          version: e
        }
      }, i.prototype.getPageInfo = function () {
        var t = ht(),
          e = at() || {},
          r = ut,
          i = (e.data || {}).title || e.title;
        try {
          void 0 === i && t && !Ot[t] && (Ot[t] = !0, console.warn("\u9875\u9762[" + t + "]\u6ca1\u6709\u5b9e\u73b0 title \u5c5e\u6027\uff0c\u4f1a\u5bfc\u81f4\u90e8\u5206\u673a\u578b\u4e0b\u6536\u96c6\u4e0d\u5230\u9875\u9762\u6807\u9898!")), "string" == typeof i && (r = function () {
            return i
          }), "function" == typeof i && (r = i)
        } catch (t) {
          console.error("curPage.data.title \u6267\u884c\u9519\u8bef", t)
        }
        return {
          page: t,
          page_title: i || r()
        }
      }, i.prototype.isDev = function () {
        return dt()
      }, i.create = function () {
        var t;
        try {
          t = new i
        } catch (e) {
          t = i.prototype, console.error("new sr_sdk failed", e)
        }
        return t
      }, i
    }(gt).create(),
    Ut = Page,
    qt = Component;
  return Page = function (t) {
    if (Pt.option.proxyPage) {
      var e = St(Pt.track.bind(Pt), Pt.setChan.bind(Pt), Pt.setContext.bind(Pt), Pt.option.autoTrack, Pt.option.openSdkShareDepth);
      Ut(e(t))
    } else Ut(t)
  }, Component = function (t) {
    if (Pt.option.proxyComponent) {
      var e = Ct(Pt.track.bind(Pt), Pt.setChan.bind(Pt), Pt.setContext.bind(Pt), Pt.option.autoTrack, Pt.option.openSdkShareDepth);
      return qt(e(t))
    }
    return qt(t)
  }, Pt
}));